home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 5 / chrpro3.zip / CFBNEWMO.CMD < prev    next >
OS/2 REXX Batch file  |  1991-01-21  |  3KB  |  109 lines

  1. * Program CFBNEWMO - Updates the ACCOUNTS file for a new month.
  2. Use
  3. Select primary
  4. Store d+':accounts' to MFILE
  5. Use &MFILE index &MFILE
  6. Store d+':ACCOUNTX' to NFILE
  7. Copy structure to &NFILE
  8. Select secondary
  9. Use &NFILE
  10. Select primary
  11. GOTO TOP
  12. ?
  13. ? '         New ACCOUNTX file is now being created.    ',curdate
  14. ?
  15. ? '                         RECEIVED      PAID     NEW YTD    NEW YTD   '
  16. ?? ' Balance'
  17. ? '     Department         THIS MONTH  THIS MONTH  RECEIVED     PAID    '
  18. ?? ' on hand'
  19. ?
  20. Store 0.00 to RTMT
  21. Store 0.00 to PTMT
  22. Store 0.00 to RTYT
  23. Store 0.00 to PTYT
  24. Store 0.00 to boht
  25. Store '0' to N
  26. Do while N<>'9'.and.Account='D'.and. .not. EOF
  27.   Store str(val(N)+1,1) to N
  28.   Store $(account,1,2) to INDEPT
  29.   Select secondary
  30.   Append blank
  31.   Replace prevowed with P.prevowed
  32.   Replace PAIDYTD with str(val(P.PAIDYTD)+P.NEWOWED,9,2)
  33. * Replace newpdate with str(val(P.NEWPDATE)-P.NEWOWED,8,2)
  34.   Replace newpdate with P.newpdate
  35.   Replace account with p.account
  36.   Store P.NEWOWED to ptm
  37.   Store paidytd to pty
  38.   Store 'R'+$(INDEPT,2,1)+'  ' to INDEPTR
  39.   Store val(P.newpdate)-P.newowed to boh
  40.   Append blank
  41.   Replace account with indeptr+$(P.ACCOUNT,5,24)
  42.   Select primary
  43.   Store # to currec
  44.   Find &INDEPTR
  45.   * Append a Receivables record
  46.   Store val(paidytd) to rty
  47.   If #=0
  48.     Store '    0.00' to rtm
  49.     Select secondary
  50.     ? 'No Receivables found for Dept.',INDEPT
  51.     Replace PAIDYTD with '     0.00'
  52.   else
  53.     Store newpaid to rtm
  54.     Select secondary
  55.     Replace PAIDYTD with str(val(P.PAIDYTD)+P.NEWPAID,9,2)
  56.     Replace prevowed with rtm+P.newpaid-ptm
  57.   endif
  58.   ? $(account,2,22),rtm,ptm,paidytd,pty,boh
  59.   Store rtmt+rtm to rtmt
  60.   Store ptmt+ptm to ptmt
  61.   Store rtyt+val(paidytd) to rtyt
  62.   Store ptyt+val(pty) to ptyt
  63.   Store boht+boh to boht
  64.   Select primary
  65.   GOTO currec
  66.   Store 64 to I
  67.   Do while account=INDEPT .and. .not. EOF
  68.     SKIP
  69.     If !($(account,26,1))='C' .and. $(account,3,1)<>' '
  70.       Store prevowed+newowed-newpaid to powed
  71.       Select secondary
  72.       Append blank
  73.       Store I+1 to I
  74.       Store chr(I) to N
  75.       Replace account with $(P.account,1,2)+N+$(P.account,4,25)
  76.       Store 0.00 to npaid
  77.       If P.PP='*'
  78.         Store P.newpaid to npaid
  79.       endif
  80.       Replace paidytd with str(val(P.paidytd)+npaid,9,2)
  81.       Replace prevowed with powed
  82.       Select primary
  83.     endif
  84.   enddo
  85. enddo
  86. ? '                          --------    --------  --------  --------'
  87. ?? '   --------'
  88. Store str(rtmt,12,2)+str(ptmt,12,2)+str(rty,10,2)+str(ptyt,10,2)+;
  89.    str(boht,12,2) to XX
  90. ? '                      '+XX
  91. ?
  92. Select secondary
  93. Use
  94. Select primary
  95. Use
  96. Accept 'Do you want the new ACCOUNTX file to be copied in place of ACCOUNTS? ';
  97.   to XX
  98. If !(XX)='Y'
  99.   delete file &MFILE
  100.   Rename &NFILE to &MFILE
  101.   Use &MFILE
  102.   Index on account to &MFILE
  103.   ? 'File',NFILE,'is now copied over file',MFILE,'.'
  104. endif
  105. RELEASE NFILE,RTMT,PTMT,rtyt,ptyt,boht,indept,ptm,pty,indeptr,boh,currec,powed
  106. Release rtm,rty,npaid,acctact
  107. RETURN
  108.  
  109. ect secondar